$(function(){
	$('#user_menu_close').click(function(e) {
		e.preventDefault();
		e.stopPropagation();
		$("#user_menu").toggle('normal');
		var type = $(this).attr("alt");
		if(type == "hide"){
			$(this).find("img").attr("src",$("#base_url").attr("alt")+"img/arrow_down.png");
			$(this).attr("alt","show");
		}else{
			$(this).find("img").attr("src",$("#base_url").attr("alt")+"img/arrow_right.png");
			$(this).attr("alt","hide");
		}
	});
	$('.polling_toggle').click(function(){
		var type = $(this).attr("alt");
		if(type == "hide"){
			$('.polling').slideDown('slow');
			$(this).attr('alt','show');
		}else{
			$('.polling').slideUp('slow');
			$(this).attr('alt','hide');
		}
	});
	$('#btnPolling').click(function(){
		var polling = $("input[@name=polling]:checked").val();
		if(polling == undefined || polling == ""){
			alert("Please choose an option in the polling form");
		}else{
			$.post($("#base_url").attr("alt")+"home/polling",{polling:polling},function(data){
				alert(data);
			});
		}
	});
});